package org.niux.aims.action;

import javax.annotation.Resource;

import org.niux.aims.common.web.AimsBaseAction;
import org.niux.aims.service.IAccountService;
import org.niux.aims.service.ILogsService;
import org.niux.aims.vo.AccountVO;

/**
 * 
 * Copyright (c) 2009,niux<br>
 * All rights reserved.<br>
 * 
 * 文件名称：AccountManagerAction.java<br>
 * 摘    要：账户管理页面类<br>
 * <br>
 * 当前版本：<br>
 * 作    者：铭显 Email: <a href="mailto:liangmingxian@gmail.com">liangmingxian@gmail.com</a><br>
 * 完成日期：@since 2013-8-27<br>
 * <br>
 * 取代版本：<br>
 * 原作者  ：<br>
 * 完成日期：@since Oct 22, 2009<br>
 */
public class AccountManagerAction extends AimsBaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5541040549884839089L;
	
	@Resource(name="accountService")
	private IAccountService accountService;
	
	@Resource(name="logsService")
	private ILogsService logsService;
	
	private int accountCount;
	private String accountName;
	
	/**
	 * 
	 * 方法概述：页面渲染
	 * 描述：页面渲染
	 * @return
	 * 返回类型：String
	 * 修改人：梁铭显
	 * 修改时间：2013-8-27
	 */
	public String showPage(){
		logsService.addLog("【"+((AccountVO)super.getSession().get("account")).getName()+"】进入账户管理");
		accountCount = accountService.findAll().size();
		super.getRequest().setAttribute("currentAccountId", ((AccountVO)super.getSession().get("account")).getId());
		return SUCCESS;
	}
	
	/**
	 * 
	 * 方法概述：账户查询
	 * 描述：账户查询
	 * @return
	 * 返回类型：String
	 * 修改人：梁铭显
	 * 修改时间：2013-9-2
	 */
	public String searchAccount(){
		logsService.addLog("【"+((AccountVO)super.getSession().get("account")).getName()+"】查询账户“"+accountName+"”");
		accountCount = accountService.findByAccountName(accountName).size();
		return SUCCESS;
	}

	public int getAccountCount() {
		return accountCount;
	}

	public void setAccountCount(int accountCount) {
		this.accountCount = accountCount;
	}

	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

}
